//
//  TTPageManager.m
//  Tint
//
//  Created by Kevin Wu on 2/27/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import "TTPageManager.h"

@implementation TTPageManager


#pragma mark - Accessors

@synthesize total = _total;
@synthesize size = _size;
@synthesize page = _page;


#pragma mark - Public

- (BOOL)hasNext {
    if (_total == 0)
        return YES;
    
    return [self doHaveNext];
}

- (BOOL)doHaveNext {
    return ((_page * _size) < _total);
}

- (NSUInteger)nextIndex {
    if (_total == 0) {
        return 1;
    }
    return _page + 1;
}

- (void)reset {
    _total = 0;
    _size = 0;
    _page = 0;
}

@end
